﻿using DAO;
using Spring.Context;
using Spring.Context.Support;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SpringNETCreateObject
{
    class Program
    {
        static void Main(string[] args)
        {
            IApplicationContext ctx = ContextRegistry.GetContext();
            AppConfigObject dao = ctx.GetObject("AppConfigObject") as AppConfigObject;
            dao.Run();

            IApplicationContext ctx1 = new XmlApplicationContext(
                "file://Objects.xml"
                );

            XMLObject xo = ctx.GetObject("XMLObject") as XMLObject;
            xo.Run();
            XMLObject xo1 = ctx1.GetObject("XMLObject") as XMLObject;
            xo1.Run();

            BaseDAO normaldao = ctx.GetObject("normaldao") as BaseDAO;
            normaldao.Run();

            BaseDAO nesteddao = ctx.GetObject("nesteddao") as BaseDAO;
            nesteddao.Run();

            BaseDAO genericdao = ctx.GetObject("genericdao") as BaseDAO;
            genericdao.Run();

            Console.ReadKey();
        }
    }
}
